package com.hps.demo.consumer;

import com.hps.demo.api.CalculatorService;
import com.hps.demo.api.HelloService;

/**
 * @Author hps
 * @Description:
 * @Date Created in 18:40 2019/7/11
 */
public class RpcConsumer {

    public static void main(String[] args) {

        HelloService helloService = RpcClient.getService(HelloService.class);
        CalculatorService calculatorService = RpcClient.getService(CalculatorService.class);

        while (true) {
            String result = helloService.sayHello("Hps");
            System.out.println(result);

            System.out.println("6 + 2 = " + calculatorService.add(6, 2));
            System.out.println("6 - 2 = " + calculatorService.sub(6, 2));
            System.out.println("6 * 2 = " + calculatorService.mul(6, 2));
            System.out.println("6 / 2 = " + calculatorService.div(6, 2));

            try {
                Thread.sleep(2000);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
